﻿@using MsForgeReboot.Web.Models
@model MsForgeReboot.Framework.Entities.BlogPost

@section Header{
    <script src="~/Scripts/ckeditor/ckeditor.js"></script>
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(false)

    <fieldset>
        <legend>Blog Post</legend>
        
        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UrlPointer)
        </div>
        <div class="editor-field">
            <span id="UrlPointerDisaply"></span>
            @Html.ValidationMessageFor(model => model.Title)
            @Html.HiddenFor(model => model.UrlPointer)
        </div>
        
        @{ Html.RenderPartial("URLPointerCleanUp", new UrlPointeViewModel { Title = "Title", UrlPointer = "UrlPointer", SpanId = "UrlPointerDisaply" }); }

        <div class="editor-label">
            @Html.LabelFor(model => model.Body)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Body)
            @Html.ValidationMessageFor(model => model.Body)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Published)
        </div>
        <div class="editor-field">
            @Html.HiddenFor(model => model.Published)
            @Html.DisplayFor(model => model.Published)
        </div>
        
        @if (Model.Author != null) {
            @Html.HiddenFor(model => model.Author.Id)
            @Html.HiddenFor(model => model.Author.Username)
            @Html.HiddenFor(model => model.Author.PublicName)
            
            <div class="editor-label">
                @Html.LabelFor(model => model.Author.PublicName)
            </div>
            <div class="editor-field">
                @Html.DisplayFor(model => model.Author.PublicName)
            </div>
        
        }
        <p>
            <button type="submit" class="btn btn-success">Snimi <i class="icon-save"></i></button>
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
<script>
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/controlpanel/blog/edit")
}</script>
